//
//  ConstUtil.swift
//  KJLGT
//
//  Created by jenkin on 2019/8/7.
//  Copyright © 2019年 jenkin. All rights reserved.
//

import Foundation

let KScreenW:CGFloat = UIScreen.main.bounds.size.width
let KScreenH:CGFloat = UIScreen.main.bounds.size.height
let KChannel: String = "appStore"
let KRate:Double = Double(KScreenW / 375.0)
let AppSignKey:String = "e924c632450d34ff4e88db4bdfb8c375"  //签名key
let AppAesKey:String = "ab36ac9a8bc786c51fdf9303245130af" //aes key
let AppAesIV:String = "01c0de6b189ab4c438589d36a00027b6" //aes iv
let SystemVersion:String = UIDevice.current.systemVersion //系统版本
//let APPUUID = BaseUtil.baseUtil.getUUID() //设备标示
let WX_APPID = "wxa661474c06a265e7"

#if TARGET_IPHONE_SIMULATOR//模拟器
let IS_SIMULATOR:Bool = true
#else//真机
let IS_SIMULATOR:Bool = false
#endif

func IPHONEXState() -> Bool{
    return LGTOCBaseUtil.ispHoneX()
}

func StatueH() -> Double{
    if IPHONEXState() == true{
        return 44.0
    }
    return 20.0
}

func NavBarH() -> Double{
    if IPHONEXState() == true{
        return  88.0
    }
    return 64.0
}

func TabBarH() ->Double{
    if IPHONEXState() == true{
        return 83.0
    }
    return 49.0
}

// iphoneX的导航栏高度差
func IPHONENAV_DIS() -> Double{
    if IPHONEXState() == true {
        return 24.0
    }
    return 0
}

func IPHONETabbar_DIS() -> Double{
    if IPHONEXState() == true{
        return 34.0
    }
    return 0
}

func SizeFit(_ s:Double) -> Double{
    return Double(Int(s * KRate))
}

func SizeFitFloat(_ s:Double) -> CGFloat{
    return CGFloat(Int(s * KRate))
}

func ColorUtil(color:Int, alpha:Double = 1.0) -> UIColor{
    return BaseUtil.baseUtil.getHexColor(colorHex: color, alpha:alpha)
}

func KFont(size:CGFloat) -> UIFont{
    return BaseUtil.baseUtil.getFont(size: size)
}

func KBFont(size:CGFloat) -> UIFont{
    return BaseUtil.baseUtil.getBFont(size: size)
}

//func weakSelf(_ s:AnyObject) -> AnyObject{
//    weak var weak_self = s
//    return weak_self
//}

//版本信息
var infoDictionary:[String: Any] = {
    return Bundle.main.infoDictionary ?? [:]
}()

var AppVersion:String = {
    return infoDictionary["CFBundleVersion"];
    }() as! String

var AppName:String = {return infoDictionary["CFBundleDisplayName"]}() as! String

//git 加载动画宽高
let KGif_Width = SizeFitFloat(70)
let KGif_Height = SizeFitFloat(70)

enum StepCellClickType:Int{
    case delete = 0 //删除
    case movedonw = 1 //下移动
    case moveup = 2 //上移动
    case edit = 3 //编辑
    case openurl = 4 //打开链接
    case copyurl = 5 //复制链接
    case copydata = 6 //复制数据
    case addCheckImage = 7 //添加上传图片
    case ImageBrower = 8 //浏览视图
}

//图片限制最大
let ImageLimitMax = CGFloat(1600)

//color
let NavTitleColor = BaseUtil.baseUtil.getHexColor(colorHex: 0x333333, alpha: 1)
let TextColor = BaseUtil.baseUtil.getHexColor(colorHex: 0x333333, alpha: 1)
let BlackColor = BaseUtil.baseUtil.getHexColor(colorHex: 0x0000000, alpha: 1)
let BlackAlphaColor = BaseUtil.baseUtil.getHexColor(colorHex: 0x000000, alpha: 0.5)
let GrayColor = BaseUtil.baseUtil.getHexColor(colorHex: 0x999999, alpha: 1)
let BlueColor = BaseUtil.baseUtil.getHexColor(colorHex: 0x1C7FFB, alpha: 1)
let YellowColor = BaseUtil.baseUtil.getHexColor(colorHex: 0xFFB21A, alpha: 1)
let AllLineColor = BaseUtil.baseUtil.getHexColor(colorHex: 0xEFEFEF)
let DisableColor = BaseUtil.baseUtil.getHexColor(colorHex: 0xB3B3B3)
let ViewBackColor = BaseUtil.baseUtil.getHexColor(colorHex: 0xF5F5F5)
let RedColor = BaseUtil.baseUtil.getHexColor(colorHex: 0xf23030)
let SwitchBackColor = BaseUtil.baseUtil.getHexColor(colorHex: 0xe5e5e5)
let GreenColor = BaseUtil.baseUtil.getHexColor(colorHex: 0x00B38A)
let TabBarItemColor = BaseUtil.baseUtil.getHexColor(colorHex: 0x9B9B9B)
let TabBarItemSelectColor = BaseUtil.baseUtil.getHexColor(colorHex: 0xFFB21A)
let MainTintColor = BaseUtil.baseUtil.getHexColor(colorHex: 0xFFB21A)
let BlackAlpha46 = BaseUtil.baseUtil.getHexColor(colorHex: 0x000000, alpha: 0.46)
//let RedColor = BaseUtil.baseUtil.getHexColor(colorHex: 0xF62E00)

//font
let Font_Normal_12 = BaseUtil.baseUtil.getFont(size: CGFloat(KRate * 12))
let Font_Normal_14 = BaseUtil.baseUtil.getFont(size: CGFloat(KRate * 14))
let Font_Normal_16 = BaseUtil.baseUtil.getFont(size: CGFloat(KRate * 16))
let Font_Normal_15 = BaseUtil.baseUtil.getFont(size: CGFloat(KRate * 15))
let Font_Normal_17 = BaseUtil.baseUtil.getFont(size: CGFloat(KRate * 17))
let Font_Normal_18 = BaseUtil.baseUtil.getFont(size: CGFloat(KRate * 18))
let Font_Bold_18 = UIFont.boldSystemFont(ofSize: SizeFitFloat(18))
let Font_Bold_13 = UIFont.boldSystemFont(ofSize: SizeFitFloat(13))
let Font_Bold_14 = UIFont.boldSystemFont(ofSize: SizeFitFloat(14))
let Font_Bold_24 = UIFont.boldSystemFont(ofSize: SizeFitFloat(24))
let UserCell_Set_Size = CGFloat(SizeFit(16))

//通知
let WX_Authe_Note = NSNotification.Name(rawValue: "WX_Authe_Note") //微信授权
let Login_Success_Note = NSNotification.Name(rawValue: "Login_Success") //登录成功
let Bind_WX_Note = NSNotification.Name(rawValue: "Bind_WX_Note") //绑定微信通知
//支付成功回掉
let Pay_Success_Note = NSNotification.Name(rawValue: "Pay_Success_Note")
//微信充值回掉
let WXPay_ReCharge_Note = NSNotification.Name(rawValue: "WXPay_ReCharge_Note")
//用户角色切换
let User_Role_Change_Note = NSNotification.Name(rawValue: "User_Role_Change_Note")
//被迫下线
let Offline_Note = NSNotification.Name(rawValue: "Offline_Note")
//订单状态视图切换
let Order_ViewChange_Note = NSNotification.Name(rawValue: "Order_ViewChange_Note")
//界面修改消息通知
let LLZ_TaskChange_Note = NSNotification.Name(rawValue: "LLZ_TaskChange_Note")
//未读数量处理
let App_Bage_Note = NSNotification.Name(rawValue: "App_Bage_Note")

//block声明
//typealias funcBlock = () -> () //或者 () -> Void
////返回值是String
//typealias funcBlockA = (Int,Int) -> String
typealias ClickBlock = () -> Void
typealias ImageEditBlock = (_ data:Array<String>) -> Void
typealias ClickReturnStrBlock = (_ tag:String) -> Void
typealias ClickIndexBlock = (_ tag:Int) -> Void
typealias ClickIndexViewBlock = (_ tag:Int, _ view:UIView) -> Void
typealias ClickIndexWithIndexBlock = (_ tag:Int, _ index:Int) -> Void
typealias ClickInfoBlock = (_ index:Int,_ info:Dictionary<String, Any>) -> Void
typealias ClickPathBlock = (_ data:Any, _ path:IndexPath) -> Void

typealias ClickImageIndexBlock = (_ data:Dictionary<String, Any>, _ index:Int, _ view:UIView) -> Void
typealias ClickStepPathBlock = (_ data:Dictionary<String, Any>, _ path:IndexPath, _ index:Int, _ view:UIView?) -> Void
typealias ClickPostNameModelBlock = (_ data:PostNameModel,_ path:IndexPath) -> Void
typealias ClickCellStrBlock = (_ data:String,_ path:IndexPath) -> Void


//图片声明
let Net_NoData_Image = "networkanomaly"
let Net_Error_Text = "网络异常"
let Net_Reload_Text = "你还可以点击重新加载~"

//没有数据
let NoData_Image = "nodata"
let NoData_Text = "暂无数据"

//   //FF1A1A  46B25F 999999 FFB21A 999999 333333 3BB1EE
//status (integer, optional): 状态[1-审核中,2-未通过,3-派发中,4-暂停中,5-已撤回,6-已过期,7-已完成] ,
//let 订单状态对应的
let TaskStateInfo:Dictionary<String, Any> = ["1":["title":"审核中",
                                               "color": BaseUtil.baseUtil.getHexColor(colorHex: 0x3BB1EE),
                                               "desc":"申请份数",
                                               "timeDesc":"提交审核时间："],
                                          "2":["title":"未通过",
                                               "color": BaseUtil.baseUtil.getHexColor(colorHex: 0x3333333),
                                               "desc":"申请份数",
                                               "timeDesc":"提交审核时间："],
                                          "3":["title":"派发中",
                                               "color": BaseUtil.baseUtil.getHexColor(colorHex: 0xFF1A1A),
                                               "desc":"剩余份数",
                                               "timeDesc":"上线时间："],
                                          "4":["title":"暂停中",
                                               "color": BaseUtil.baseUtil.getHexColor(colorHex: 0xFFB21A),
                                               "desc":"剩余份数",
                                               "timeDesc":"暂停时间："],
                                          "5":["title":"已撤回",
                                               "color": BaseUtil.baseUtil.getHexColor(colorHex: 0x999999),
                                               "desc":"完成份数",
                                               "timeDesc":"撤回时间："],
                                          "6":["title":"已过期",
                                               "color": BaseUtil.baseUtil.getHexColor(colorHex: 0x999999),
                                               "desc":"剩余份数",
                                               "timeDesc":"过期时间："],
                                          "7":["title":"已完成",
                                               "color": BaseUtil.baseUtil.getHexColor(colorHex: 0x46B25F),
                                               "desc":"完成份数",
                                               "timeDesc":"完成时间："],
                                          "8":["title":"已下架",
                                               "color": BaseUtil.baseUtil.getHexColor(colorHex: 0x999999),
                                               "desc":"剩余份数",
                                               "timeDesc":"下架时间："]
]

let RWZOrderStateInfo:Dictionary<String, Any> = [
    "1":[:],
    "2":[:],
    "3":[:],
    "4":["title":"待审核", "color": ColorUtil(color: 0x00B55F),"time":"提交审核时间："],
    "5":["title":"审核通过", "color": ColorUtil(color: 0x00B55F),"time":"审核通过时间："],
    "6":["title":"审核未通过", "color": ColorUtil(color: 0x00B55F),"time":"审核时间："],
    "7":["title":"审核未通过", "color": ColorUtil(color: 0x00B55F),"time":"审核时间："],
    "8":["title":"申诉待处理", "color": ColorUtil(color: 0x3D88F8),"time":"提交申诉时间："],
    "9":["title":"申诉通过", "color": ColorUtil(color: 0x3D88F8),"time":"处理申诉时间："],
    "10":["title":"申诉未通过", "color": ColorUtil(color: 0x3D88F8),"time":"处理申诉时间："],
    "11":["title":"申诉未通过", "color": ColorUtil(color: 0x3D88F8),"time":"处理申诉时间："],
    "12":["title":"介入中", "color": ColorUtil(color: 0xFF551A),"time":"申请介入时间："],
    "13":["title":"介入通过", "color": ColorUtil(color: 0xFF551A),"time":"介入处理时间："],
    "14":["title":"介入未通过", "color": ColorUtil(color: 0xFF551A),"time":"介入处理时间："],
    "15":["title":"审核通过", "color": ColorUtil(color: 0x00B55F),"time":"审核通过时间："],  //审核过期通过
    "16":["title":"申诉通过", "color": ColorUtil(color: 0xFF551A),"time":"申诉通过时间："], //申诉过期通过
   ]

//status (integer, optional): 状态[1-审核中,2-未通过,3-派发中,4-暂停中,5-已撤回,6-已过期,7-已完成,8-已下架] ,
let TaskDetailInfo:Dictionary<String, Any> = [
    "2":["icon": "redfailed", "title":"状态：未通过"],
    "7":["icon": "completedgreen", "title":"状态：已完成"],
    "1":["icon": "completedgreen", "title":"状态：审核中"],
    "3":["icon": "bluedistribution", "title":"状态：派发中"],
    "4":["icon": "pauseinorange", "title":"状态：暂停中"],
    "5":["icon": "pauseinorange", "title":"状态：已撤回"],
    "6":["icon": "pauseinorange", "title":"状态：已过期"],
    "8":["icon": "pauseinorange", "title":"状态：已下架"]
]

//流量主
let LLZOrderStateInfo:Dictionary<String, Any> = [
    //申请未提交
    "1":["title": "待提交", "color": ColorUtil(color: 0x00B55F), "time":"提交审核时间："],
    "2":["title": "已放弃", "color": ColorUtil(color: 0x999999), "time":"放弃时间："],
    "3":["title": "已过期", "color": ColorUtil(color: 0x999999), "time":"申请时间："],
    "4":["title": "审核中", "color": ColorUtil(color: 0xFFB21A), "time":"审核时间："],
    "5":["title": "审核通过", "color": ColorUtil(color: 0xFFB21A), "time":"审核通过时间："],
    "6":["title": "审核未通过", "color": ColorUtil(color: 0xFFB21A), "time":"审核时间："],
    "7":["title": "审核未通过", "color": ColorUtil(color: 0xFFB21A), "time":"审核时间："],
    "8":["title": "申诉中", "color": ColorUtil(color: 0x3D88F8), "time":"申诉处理时间："],
    "9":["title": "申诉通过", "color": ColorUtil(color: 0x3D88F8), "time":"申诉通过时间："],
    "10":["title": "申诉未通过", "color": ColorUtil(color: 0x3D88F8), "time":"申诉处理时间："],
    "11":["title": "申诉未通过", "color": ColorUtil(color: 0x3D88F8), "time":"申诉处理时间："],
    "12":["title": "介入中", "color": ColorUtil(color: 0xFF551A), "time":"介入时间："],
    "13":["title": "介入通过", "color": ColorUtil(color: 0xFF551A), "time":"介入通过时间："],
    "14":["title": "介入未通过", "color": ColorUtil(color: 0xFF551A), "time":"介入时间："],
    //FFB21A FFB21A
    "15":["title": "审核通过", "color": ColorUtil(color: 0xFFB21A), "time":"审核时间："], //审核过期通过
    "16":["title": "申诉通过", "color": ColorUtil(color: 0x3D88F8), "time":"审核时间："] //申诉过期通过
]

//任务步骤
//1、输入网址（最多可创建1条）；
//2、上传二维码（最多可创建8条）；
//3、复制数据（最多可创建8条）；
//4、图文说明（最多可创建8条）；
//5、验证图（最多可创建8条）；
//6、收集信息（最多可创建1条）；



//订单状态 修改值
//const EXECUTE = 1; //申请未提交
//const CANCEL = 2; //已放弃
//const EXPIRED = 3; //已过期
//const REVIEW = 4; //审核中
//const SUCCESS = 5; //审核通过
//const REFUSE = 6; //审核未通过
//const FAIL = 7; //审核未通过过期
//const APPEAL = 8; //申诉中
//const SUCCESS1 = 9; //申诉通过
//const REFUSE1 = 10; //申诉未通过
//const FAIL1 = 11; //申诉未通过过期
//const ADJUDICATION = 12; //介入中
//const SUCCESS2 = 13; //介入通过
//const FAIL2 = 14; //介入未通过
//const SUCCESS3 = 15; //审核过期自动通过
//const SUCCESS4 = 16; //申诉过期自动通过
